package com.dzsw.rabbitmq.service.impl;

import com.dzsw.rabbitmq.mq.MsgProvider;
import com.dzsw.rabbitmq.service.IRabbitMQService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class RabbitMQServiceImpl implements IRabbitMQService {

    @Resource
    private MsgProvider msgProducer;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void send2FanoutTestQueue(String msg) {
        msgProducer.send2FanoutTestQueue(msg);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void send2DirectTestQueue(String msg) {
        msgProducer.send2DirectTestQueue(msg);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void send2TopicTestAQueue(String msg) {
        msgProducer.send2TopicTestAQueue(msg);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void send2TopicTestBQueue(String msg) {
        msgProducer.send2TopicTestBQueue(msg);
    }
}
